package com.sans.linear;

import org.junit.Test;

import java.util.Queue;
import java.util.Stack;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * @author Sans
 */
public class StackQueueTest {
    @Test
    public void stack() {
        Stack<Integer> stack = new Stack<>();
        stack.push(100);
        stack.push(200);
        stack.push(300);

        System.out.println(stack.pop());
        System.out.println(stack.pop());

        System.out.println(stack.peek());

        System.out.println(stack);
    }

    @Test
    public void queue() {
        Queue<Integer> queue = new LinkedBlockingQueue<>();
        queue.add(100);
        queue.add(200);
        queue.add(300);

        System.out.println(queue.poll());
        System.out.println(queue.poll());

        System.out.println(queue.peek());

        System.out.println(queue);
    }
}
